﻿#include "PlayerController.h"

PlayerController::PlayerController(){}

PlayerController::~PlayerController(){}

void PlayerController::viewDidLoad(){
    CAView* view=this->getView();
    view->setColor(CAColor4B::BLACK);
	this->setNavigationBarItem(CANavigationBarItem::create("播放视频"));
	
	web=CAWebView::createWithLayout(DLayoutFill);
	web->setVisible(false);
	web->showLoadingActivity(true);
	web->setColor(CAColor4B::BLACK);
	web->loadFile("html/xgplayer.html");
	web->onFinishLoading([&](const string& msg){
		  web->evaluateJS("start()");
		  web->showLoadingActivity(false);
	});
	view->addSubview(web);
}

void PlayerController::viewDidUnload(){
	web=nullptr;
}